![]() |
PATH![]() |
The functions for getting information about the USB topology are defined in this section.
The USBGetDeviceDescriptor function returns a pointer to the device descriptor of the specified device reference.
OSStatus USBGetDeviceDescriptor (
USBDeviceRef *deviceRef,
USBDeviceDescriptor *deviceDescriptor,
UInt32 size);
The USBGetInterfaceDescriptor function returns a pointer to the interface descriptor of supplied device reference.
OSStatus USBGetInterfaceDescriptor (
USBInterfaceRef *interfaceRef,
USBInterfaceDescriptor *InterfaceDescriptor,
UInt32 size);
The USBGetNextDeviceByClass function returns a class driver reference for the class driver matching the specified device class and optionally the device subclass for that device.
The USBGetNextDeviceByClass function returns a pointer to the next usbDeviceRef for a class driver matching the specified deviceClass and (optionally) deviceSubClass and deviceProtocol parameters. Pass kNoDeviceRef for the deviceRef parameter to begin, then pass the returned device reference for subsequent searches.
An OSStatus error of -43 is returned if a device cannot be found with the specified parameters. The device reference, deviceRef, returns unchanged if no subsequent match is made. The typical way to find all similar devices is to keep calling the USBGetNextDeviceByClass function until the status value changes from noErr . At that point, the deviceRef is officially undefined.
The driver descriptor structure must have the same class and subclass codes as the codes for the device that is specified in the function call. This is particularly important for vendor specific devices, since the correct driver for the device would not typically load if the class and subclass codes don't match those for the device.
If you are developing a device and the USBGetNextDeviceByClass function isn't finding the requested device, be sure that the driver descriptor structure for your device driver has the same class and subclass codes as the device.
Constants are defined for the device class, subclass, protocol, vendor, and product identifiers which you can pass as wildcard values in the functions USBGetNextDeviceByClass and USBInstallDeviceNotification in Installing The Device Callback Request .
Note
In USB version 1.0.1 (the iMac update 1.0) a bug prevented correct searches if usbClass, usbSubclass, and usbProtocol were equal 0 and kNoDeviceRef is used for the deviceRef . This behavior is not present in version 1.1 and greater of the Mac OS USB software.
The USBGetDriverConnectionID function returns a pointer to the CFragConnectionID of the driver referenced by the device reference.
OSStatus USBGetDriverConnectionID (
USBDeviceRef *deviceRef,
CFragConnectionID *connID);
Previous | Back Up One Level | Next |